<template>
  <div class="container-login">
    <div class="wide-box">
      <img
        class="bg-image"
        src="http://127.0.0.1:9000/oj-files/bg-a.gif"
        alt="背景图片"
      />
      <div class="content">
        <header class="header">
          <img style="width: 36px" src="@/assets/long.png" />
          <div class="header-text">CodeInsight AI</div>
        </header>
        <div class="form-wrapper">
          <a-tabs v-model:active-key="tabActiveKey" animation :justify="true">
            <a-tab-pane key="1" class="login-form-tab1" destroy-on-hide>
              <template #title>
                <icon-user-group />
                登录
              </template>
              <LoginForm />
            </a-tab-pane>
            <a-tab-pane key="2" class="register-form-tab" destroy-on-hide>
              <template #title>
                <icon-user-add />
                注册
              </template>
              <RegisterForm />
            </a-tab-pane>
          </a-tabs>
        </div>
      </div>
    </div>
    <Footer />
  </div>
</template>

<script lang="ts" setup>
import LoginForm from './components/login-form.vue';
import { ref } from 'vue';
import RegisterForm from '@/views/login/components/register-form.vue';
import { IconUserGroup, IconUserAdd } from '@arco-design/web-vue/es/icon'; // 引入图标组件

const tabActiveKey = ref('1');
</script>

<style lang="less" scoped>
.form {
  &-wrapper {
    width: 550px;
    height: 100%;
    padding: 65px 24px 12px;
    overflow: hidden;
    background-color: #fff;
    border: 1px solid var(--color-border-2);
    border-radius: var(--border-radius-large);
  }

  &-title {
    margin-bottom: 16px;
    font-size: 24px;
    font-weight: 500;
    line-height: 32px;
    color: var(--color-text-1);
  }
}

.container-login {
  display: flex;
  height: 100vh;
  background-image: url('../../assets/images/bg-2.png');
  background-repeat: no-repeat;
  background-size: cover;
  position: relative; /* 添加相对定位 */

  .content {
    position: absolute;
    top: 50%;
    left: 68%;
    display: flex;
    transform: translate(-50%, -50%);
    background-color: #4b81ff;
  }

  .wide-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* 居中 */
    width: 1400px; /* 增加宽度 */
    height: 660px; /* 增加高度 */

    display: flex;
    align-items: center; /* 垂直居中 */
    justify-content: space-between; /* 左右内容分布 */
    padding: 20px 100px; /* 左右留出间距 */
  }

  .bg-image {
    width: 550px; /* 图片宽度 */
    height: 660px; /* 高度自适应 */
    margin-right: 50px; /* 图片与表单之间的间距 */
  }

  .footer {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 100%;
  }

  .header {
    position: fixed;
    top: 0;
    z-index: 1;
    align-items: center;
    width: 100%;
    padding: @spacing-7 @spacing-0;
    display: flex;
    justify-content: center;
    margin-bottom: 50px;
    font-weight: bolder;

    &-text {
      margin-right: 4px;
      margin-left: 4px;
      font-size: 26px;
      font-weight: 500;
      color: rgb(var(--color-text-1));
    }
  }
}

:deep(.arco-tabs-content) {
  height: 155px;
}

@media (max-height: @screen-md) {
  .footer {
    display: none;
  }
}

:deep(.arco-btn-primary) {
  background-color: #2759cd;
  border-color: #2759cd;

  &:hover,
  &:focus {
    background-color: #1a3a8f;
    border-color: #1a3a8f;
  }
}

.login-btn {
  width: 100%;
  background-color: #2759cd;
  border-color: #2759cd;

  &:hover,
  &:focus {
    background-color: #1a3a8f;
    border-color: #1a3a8f;
  }
}

:deep(.arco-tabs-tab) {
  &.arco-tabs-tab-active {
    .arco-tabs-tab-text {
      color: #2759cd;
    }
  }
}

:deep(.arco-tabs-ink-bar) {
  background-color: #2759cd;
}
</style>
